const state = {
  routerState: {
    routerHistory: [],
    routerLength: 0
  }
}

const getters = {
  getRouterHistory (state) {
    return state.routerState.routerHistory
  },
  getRouterHistoryLength (state) {
    return state.routerState.routerLength
  }
}

const actions = {

}

const mutations = {
  routerHistory (state, obj) {
    if (obj.type === 'to') {
      state.routerState.routerHistory.push(obj.router)
      state.routerState.routerLength++
    } else {
      state.routerState.routerHistory.pop()
      state.routerState.routerLength--
    }
  }
}

export default {
  state,
  getters,
  actions,
  mutations
}
